<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    li {
      list-style: none;
    }

    body,
    html {
      width: 100%;
      height: 100%;
      display: flex;
    }

    :root {
      --s: 6;
      --h: 36;
      --speed: 2s;
    }

    .g-container {
      width: 300px;
      margin: auto;
      height: calc(var(--h) * 5px);
      line-height: calc(var(--h) * 1px);
      font-size: 20px;
      background: #673ab7;
      color: #fff;
      overflow: hidden;
    }

    ul {
      display: flex;
      flex-wrap: nowrap;
      flex-direction: column;
    }

    ul li {
      flex-shrink: 0;
      width: 100%;
      padding-left: 10px;
      box-sizing: border-box;
    }

    ul {
      animation: move calc(var(--speed) * var(--s)) steps(var(--s)) infinite;
    }

    ul li {
      white-space: nowrap;
      cursor: pointer;
      animation: liMove calc(var(--speed)) infinite;
    }

    @keyframes move {
      0% {
        transform: translate(0, 0);
      }

      100% {
        transform: translate(0, calc(var(--s) * var(--h) * -1px));
      }
    }

    @keyframes liMove {
      0% {
        transform: translate(0, 0);
      }

      80%,
      100% {
        transform: translate(0, calc(var(--h) * -1px));
      }
    }
  </style>
</head>

<body>
  <div class="g-container">
    <ul>
      <li>Lorem ipsum 1111111</li>
      <li>Lorem ipsum 2222222</li>
      <li>Lorem ipsum 3333333</li>
      <li>Lorem ipsum 4444444</li>
      <li>Lorem ipsum 5555555</li>
      <li>Lorem ipsum 6666666</li>
      <!--末尾补一个首条数据-->
      <li>Lorem ipsum 1111111</li>
      <li>Lorem ipsum 2222222</li>
      <li>Lorem ipsum 3333333</li>
      <li>Lorem ipsum 4444444</li>
      <li>Lorem ipsum 5555555</li>
      <li>Lorem ipsum 6666666</li>
    </ul>
  </div>
</body>

</html>